﻿using System;
using SharpObjects.SearchEngine.Common.Search;

namespace SharpObjects.SearchEngine.Common.QueryConstraints
{
    [Serializable]
    public class TermQueryConstraint : IQueryConstraint
    {
        public string FieldName { get; set; }
        public string TermText { get; set; }
        public bool ShowFieldName { get; set; }

        public TermQueryConstraint()
        {
            this.ConstraintId = Guid.NewGuid();
        }

        public override string ToString()
        {
            if (this.ShowFieldName)
            {
                return string.Format("{0}: {1}", this.FieldName, this.TermText);
            }
            else
            {
                return this.TermText;
            }
        }

        public Guid ConstraintId { get; set; }

    }
}
